fix(client): remove ipv6 square brackets before resolving #2664
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings,
When trying to send a request to an IPv6 link local address such as
the changes that came from #1937 go a long ways toward making things work. However, when the address is passed to the resolver it still contains the square brackets. These square brackets are specific to URL-encoded [1] addresses and do not constitute a valid IPv6 address representation on their own AFAICT. So when
[fe80::1234%2]
gets passed to thegetaddrinfo
resolver on some platforms it's not recognized as an IPV6 address with a scope and an attempt at DNS resolution results.This patch moves the stripping of the square brackets a bit earlier in the call chain so that both
try_parse
andresolve
see an IPv6 address with URL-specific encoding removed.Minimum Reproducible Example
Running the following on illumos results in a failed DNS lookup, substituting in appropriate values for the address and interface index. After applying this patch, the communication works as expected.